home *** CD-ROM | disk | FTP | other *** search
/ Aminet 35 / Aminet 35 (2000)(Schatztruhe)[!][Feb 2000].iso / Aminet / gfx / misc / gnuplot-src.lha / gnuplot-3.7.1src / gnuplot-3.7.1.lha / gnuplot-3.7.1 / win / wgnuplib.h < prev    next >
Encoding:
C/C++ Source or Header  |  1999-09-21  |  10.4 KB  |  367 lines

  1. /*
  2.  * $Id: w    )Ød;            /* 2.2 1999/09/21 18:48:27 lhecking Exp $
  3.  */
  4.  
  5. /* GNUPLOT - win/wgnuplib.h */
  6.  
  7. /*[
  8.  * Copyright 1982 - 1993, 1998   Russell Lang
  9.  *
  10.  * Permission to use, copy, and distribute this software and its
  11.  * documentation for any purpose with or without fee is hereby granted,
  12.  * provided that the above copyright notice appear in all copies and
  13.  * that both that copyright notice and this permission notice appear
  14.  * in supporting documentation.
  15.  *
  16.  * Permission to modify the software is granted, but not the right to
  17.  * distribute the complete modified source code.  Modifications are to
  18.  * be distributed as patches to the released version.  Permission to
  19.  * distribute binaries produced by compiling modified sources is granted,
  20.  * provided you
  21.  *   1. distribute the corresponding source modifications from the
  22.  *    released version in the form of a patch file along with the binaries,
  23.  *   2. add special version identification to distinguish your version
  24.  *    in addition to the base release version number,
  25.  *   3. provide your name and address as the primary contact for the
  26.  *    support of your modified version, and
  27.  *   4. retain our contact information in regard to use of the base
  28.  *    software.
  29.  * Permission to distribute the released version of the source code along
  30.  * with corresponding source modifications in the form of a patch file is
  31.  * granted with same provisions 2 through 4 for binary distributions.
  32.  *
  33.  * This software is provided "as is" without express or implied warranty
  34.  * to the extent permitted by applicable law.
  35. ]*/
  36.  
  37. /*
  38.  * AUTHORS
  39.  * 
  40.  *   Russell Lang
  41.  * 
  42.  * Send your comments or suggestions to 
  43.  *  info-gnuplot@dartmouth.edu.
  44.  * This is a mailing list; to join it send a note to 
  45.  *  majordomo@dartmouth.edu.  
  46.  * Send bug reports to
  47.  *  bug-gnuplot@dartmouth.edu.
  48.  */
  49.  
  50. /* this file contains items to be visible outside wgnuplot.dll */
  51.  
  52. #ifdef _WINDOWS
  53. #define _Windows
  54. #endif
  55.  
  56. /* HBB 19990506: The following used to be #ifdef __DLL__.
  57.  * But  _export is needed outside the DLL, as well. The long-standing
  58.  * bug crashing 16bit wgnuplot on Alt-F4 or pressing the 'close' button
  59.  * stemmed here.  */
  60. #ifndef WIN32
  61. #define WINEXPORT _export
  62. #else
  63. #define WINEXPORT
  64. #endif
  65.  
  66. #define WDPROC WINAPI WINEXPORT
  67.  
  68. #define WGNUPLOTVERSION  "1.2   1996-01-18"
  69. BOOL WDPROC CheckWGNUPLOTVersion(LPSTR str);
  70.  
  71. /* ================================== */
  72. /* symbols for the two icons          */
  73. #define TEXTICON 123
  74. #define GRPICON 124
  75.  
  76. /* ================================== */
  77. /* For WIN32 API's */
  78. #ifdef WIN32
  79. /* #define DEFAULT_CHARSET ANSI_CHARSET */
  80. #define OFFSETOF(x)  (x)
  81. #define SELECTOROF(x)  (x)
  82. #define MoveTo(hdc,x,y) MoveToEx(hdc,x,y,(LPPOINT)NULL);
  83. # ifndef __TURBOC__ /* Borland C has these defines, already... */
  84. #define farmalloc(x) malloc(x)
  85. #define farrealloc(s,n) realloc(s,n)
  86. #define farfree(s) free(s)
  87. # endif /* __TURBOC__ */
  88. #endif
  89.  
  90. #ifdef __MINGW32__
  91. /* HBB 980809: MinGW32 doesn't define some of the more traditional
  92.  * things gnuplot expects in every Windows C compiler, it seems: */
  93. typedef LOGPEN *LPLOGPEN;
  94. typedef HGLOBAL GLOBALHANDLE;
  95. #define WINVER 0x0400
  96. #define HFILE_ERROR ((HFILE)-1)
  97.  
  98. /* the far mem/string function family: */
  99. #define _fstrstr(s1,s2) (strstr(s1,s2))
  100. #define _fstrchr(s,c) (strchr(s,c))
  101. #define _fstrrchr(s,c) (strrchr(s,c))
  102. #define _fstrlen(s) (strlen(s))
  103. #define _fstrcpy(d,s) (strcpy(d,s))
  104. #define _fstrncpy(d,s,n) (strncpy(d,s,n))
  105. #define _fstrcat(s1,s2) (strcat(s1,s2))
  106. #define _fmemset(s,c,n) (memset(s,c,n))
  107. #define _fmemmove(d,s,n) (memmove(d,s,n))
  108.  
  109. #endif /* __MINGW32__ */
  110. /* ================================== */
  111. /* wprinter.c - windows printer routines */
  112. void WDPROC DumpPrinter(HWND hwnd, LPSTR szAppName, LPSTR szFileName);
  113.  
  114. typedef struct tagPRINT {
  115.     HDC        hdcPrn;
  116.     HWND    hDlgPrint;
  117.     BOOL    bUserAbort;
  118.     POINT    pdef;
  119.     POINT    psize;
  120.     POINT    poff;
  121.     struct tagPRINT FAR *next;
  122. } PRINT;
  123. typedef PRINT FAR*  LPPRINT;
  124.  
  125. /* ================================== */
  126. /* wpause.c - pause window structure */
  127. typedef struct tagPW
  128. {
  129.     HINSTANCE    hInstance;        /* required */
  130.     HINSTANCE    hPrevInstance;    /* required */
  131.     LPSTR    Title;            /* required */
  132.     LPSTR    Message;        /* required */
  133.     POINT    Origin;            /* optional */
  134.     HWND    hWndParent;        /* optional */
  135.     HWND    hWndPause;
  136.     HWND    hOK;
  137.     HWND    hCancel;
  138.     BOOL    bPause;
  139.     BOOL    bPauseCancel;
  140.     BOOL    bDefOK;
  141.     WNDPROC    lpfnOK;
  142.     WNDPROC    lpfnCancel;
  143.     WNDPROC    lpfnPauseButtonProc;
  144. } PW;
  145. typedef PW FAR*  LPPW;
  146.  
  147. int WDPROC PauseBox(LPPW lppw);
  148.  
  149. /* ================================== */
  150. /* wmenu.c - menu structure */
  151. #define BUTTONMAX 10
  152. typedef struct tagMW
  153. {
  154.     LPSTR    szMenuName;        /* required */
  155.     HMENU    hMenu;
  156.     BYTE FAR * FAR *macro;
  157.     BYTE FAR *macrobuf;
  158.     int        nCountMenu;
  159.     DLGPROC    lpProcInput;
  160.     char    *szPrompt;
  161.     char    *szAnswer;
  162.     int        nChar;
  163.     int        nButton;
  164.     HWND    hButton[BUTTONMAX];
  165.     int        hButtonID[BUTTONMAX];
  166.     WNDPROC    lpfnMenuButtonProc;
  167.     WNDPROC    lpfnButtonProc[BUTTONMAX];
  168. } MW;
  169. typedef MW FAR * LPMW;
  170.  
  171. /* ================================== */
  172. /* wtext.c text window structure */
  173. /* If an optional item is not specified it must be zero */
  174. #define MAXFONTNAME 80
  175. typedef struct tagTW
  176. {
  177.     LPPRINT    lpr;            /* must be first */
  178.     HINSTANCE hInstance;        /* required */
  179.     HINSTANCE hPrevInstance;    /* required */
  180.     LPSTR    Title;            /* required */
  181.     LPMW    lpmw;            /* optional */
  182.     POINT    ScreenSize;        /* optional */
  183.     unsigned int KeyBufSize;    /* optional */
  184.     LPSTR    IniFile;        /* optional */
  185.     LPSTR    IniSection;        /* optional */
  186.     LPSTR    DragPre;        /* optional */
  187.     LPSTR    DragPost;        /* optional */
  188.     int        nCmdShow;        /* optional */
  189.     FARPROC shutdown;        /* optional */
  190.     HICON    hIcon;            /* optional */
  191.     LPSTR   AboutText;        /* optional */
  192.     HMENU    hPopMenu;
  193.     HWND    hWndText;
  194.     HWND    hWndParent;
  195.     POINT    Origin;
  196.     POINT    Size;
  197.     BYTE FAR *ScreenBuffer;
  198.     BYTE FAR *AttrBuffer;
  199.     BYTE FAR *KeyBuf;
  200.     BYTE FAR *KeyBufIn;
  201.     BYTE FAR *KeyBufOut;
  202.     BYTE    Attr;
  203.     BOOL    bFocus;
  204.     BOOL    bGetCh;
  205.     BOOL    bSysColors;
  206.     HBRUSH    hbrBackground;
  207.     char    fontname[MAXFONTNAME];    /* font name */
  208.     int        fontsize;                /* font size in pts */
  209.     HFONT    hfont;
  210.     int        CharAscent;
  211.     int        ButtonHeight;
  212.     int        CaretHeight;
  213.     int        CursorFlag;
  214.     POINT    CursorPos;
  215.     POINT    ClientSize;
  216.     POINT    CharSize;
  217.     POINT    ScrollPos;
  218.     POINT    ScrollMax;
  219.     POINT    MarkBegin;
  220.     POINT    MarkEnd;
  221.     BOOL    Marking;
  222. } TW;
  223. typedef TW FAR*  LPTW;
  224.  
  225.  
  226. /* ================================== */
  227. /* wtext.c - Text Window */
  228. void WDPROC TextMessage(void);
  229. int WDPROC TextInit(LPTW lptw);
  230. void WDPROC TextClose(LPTW lptw);
  231. void WDPROC TextToCursor(LPTW lptw);
  232. int WDPROC  TextKBHit(LPTW);
  233. int WDPROC TextGetCh(LPTW);
  234. int WDPROC TextGetChE(LPTW);
  235. LPSTR WDPROC TextGetS(LPTW lptw, LPSTR str, unsigned int size);
  236. int WDPROC TextPutCh(LPTW, BYTE);
  237. int WDPROC TextPutS(LPTW lptw, LPSTR str);
  238. void WDPROC TextGotoXY(LPTW lptw, int x, int y);
  239. int  WDPROC TextWhereX(LPTW lptw);
  240. int  WDPROC TextWhereY(LPTW lptw);
  241. void WDPROC TextCursorHeight(LPTW lptw, int height);
  242. void WDPROC TextClearEOL(LPTW lptw);
  243. void WDPROC TextClearEOS(LPTW lptw);
  244. void WDPROC TextInsertLine(LPTW lptw);
  245. void WDPROC TextDeleteLine(LPTW lptw);
  246. void WDPROC TextScrollReverse(LPTW lptw);
  247. void WDPROC TextAttr(LPTW lptw, BYTE attr);
  248. void WDPROC AboutBox(HWND hwnd, LPSTR str);
  249.  
  250. /* ================================== */
  251. /* wgraph.c - graphics window */
  252.  
  253. /* windows data */
  254. #define WGNUMPENS 15
  255.  
  256. #define GWOPMAX 4096
  257. /* GWOP is 8 bytes long. Array of GWOP kept in global block */
  258. struct GWOP {
  259.     WORD op;
  260.     WORD x, y; 
  261.     HLOCAL htext;
  262. };
  263.  
  264. /* memory block for graph operations */
  265. struct GWOPBLK {            /* kept in local memory */
  266.     struct GWOPBLK *next;
  267.     HGLOBAL hblk;            /* handle to a global block */
  268.     struct GWOP FAR *gwop;    /* pointer to global block if locked */
  269.     UINT used;                /* number of GWOP's used */
  270. };
  271.  
  272. /* ops */
  273. #define W_endoflist 0
  274. #define W_dot 10
  275. #define W_diamond 11
  276. #define W_plus 12
  277. #define W_box 13
  278. #define W_cross 14
  279. #define W_triangle 15
  280. #define W_star 16
  281. #define W_circle 17
  282. #define W_fcircle 18
  283. #define W_fbox 19
  284. #define W_fdiamond 20
  285. #define W_fitriangle 21
  286. #define W_itriangle 22
  287. #define W_move 30
  288. #define W_vect 31
  289. #define W_line_type 32
  290. #define W_put_text 33
  291. #define W_justify 34
  292. #define W_text_angle 35
  293. #define W_pointsize 36
  294.  
  295. typedef struct tagGW {
  296.     LPPRINT    lpr;            /* must be first */
  297.     HINSTANCE    hInstance;        /* required */
  298.     HINSTANCE    hPrevInstance;    /* required */
  299.     LPSTR    Title;            /* required */
  300.     int        xmax;            /* required */
  301.     int        ymax;            /* required */
  302.     LPTW    lptw;        /* optional */  /* associated text window */
  303.     POINT    Origin;        /* optional */    /* origin of graph window */
  304.     POINT    Size;        /* optional */    /* size of graph window */
  305.     LPSTR    IniFile;    /* optional */
  306.     LPSTR    IniSection;    /* optional */
  307.     HWND    hWndGraph;    /* window handle */
  308.     HMENU    hPopMenu;    /* popup menu */
  309.     int        numsolid;    /* number of solid pen styles */
  310.     int        pen;        /* current pen number */
  311.     int        htic;        /* horizontal size of point symbol (xmax units) */
  312.     int     vtic;        /* vertical size of point symbol (ymax units)*/
  313.     int        hchar;        /* horizontal size of character (xmax units) */
  314.     int        vchar;        /* vertical size of character (ymax units)*/
  315.     int        angle;        /* text angle */
  316.     BOOL    rotate;        /* can text be rotated 90 degrees ? */
  317.     char    fontname[MAXFONTNAME];    /* font name */
  318.     int        fontsize;    /* font size in pts */
  319.     HFONT    hfonth;        /* horizonal font */
  320.     HFONT    hfontv;        /* vertical font */
  321.     BOOL    resized;    /* has graph window been resized? */
  322.     BOOL    graphtotop;    /* bring graph window to top after every plot? */
  323.     BOOL    color;                    /* color pens? */
  324.     HPEN    hbpen;                    /* border pen */
  325.     HPEN    hapen;                    /* axis pen */
  326.     HPEN    hpen[WGNUMPENS];        /* pens */
  327. #if 1 /* HBB 980118: new try ... */
  328.         HPEN    hsolidpen[WGNUMPENS];           /* solid pens (for point symbols) */
  329. #endif
  330.     LOGPEN    colorpen[WGNUMPENS+2];    /* logical color pens */
  331.     LOGPEN    monopen[WGNUMPENS+2];    /* logical mono pens */
  332.     COLORREF background;            /* background color */
  333.     HBRUSH   hbrush;                /* background brush */
  334.     HBRUSH   colorbrush[WGNUMPENS+2];   /* brushes to fill points */
  335.     struct GWOPBLK *gwopblk_head;
  336.     struct GWOPBLK *gwopblk_tail;
  337.     unsigned int nGWOP;
  338.     BOOL    locked;                /* locked if being written */
  339.     double  org_pointsize;        /* Original Pointsize */
  340. } GW;
  341. typedef GW FAR*  LPGW;
  342.  
  343. #define WINFONTSIZE 10
  344. #define WIN30FONT "Courier"
  345. #define WINFONT "Arial"
  346.  
  347. #ifndef LEFT
  348. #define LEFT 0
  349. #endif
  350. #ifndef CENTRE
  351. #define CENTRE 1
  352. #endif
  353. #ifndef RIGHT
  354. #define RIGHT 2
  355. #endif
  356.  
  357. void WDPROC GraphInit(LPGW lpgw);
  358. void WDPROC GraphClose(LPGW lpgw);
  359. void WDPROC GraphStart(LPGW lpgw, double pointsize);
  360. void WDPROC GraphEnd(LPGW lpgw);
  361. void WDPROC GraphResume(LPGW lpgw);
  362. void WDPROC GraphOp(LPGW lpgw, WORD op, WORD x, WORD y, LPSTR str);
  363. void WDPROC GraphPrint(LPGW lpgw);
  364. void WDPROC GraphRedraw(LPGW lpgw);
  365.  
  366. /* ================================== */
  367.